import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# 获取dr
dr = webdriver.Chrome()
dr.get("file:///C:/Users/Administrator/Desktop/自动化测试网页/自动化测试网页/注册A.html")
# 最大化网页
dr.maximize_window()
time.sleep(2)
print("元素大小：",dr.find_element(By.ID,"userA").size)
# 元素文本
print("元素文本：",dr.find_element(By.CSS_SELECTOR,"body > div > fieldset > form > p:nth-child(5) > button").text)
# 元素属性
print("元素属性：",dr.find_element(By.ID,"passwordA").get_attribute("placeholder"))
# 元素是否被显示
print("元素显示:",dr.find_element(By.ID,"userA").is_displayed())
# 元素是否可用
print("元素是否可用:",dr.find_element(By.ID,"cancelA").is_enabled())
# 元素是否被选中
print("元素是否被选中：",dr.find_element(By.ID,"lia").is_selected())
dr.quit()